package com.zh.springcloud.controller;

import com.zh.springcloud.common.Result;
import com.zh.springcloud.entity.Payment;
import com.zh.springcloud.feign.PaymentService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @Description:
 * @ClassName OrderController
 * @date: 2021.06.09 11:17
 * @Author: zhanghang
 */
@RestController
@RequestMapping("order")
@Slf4j
public class OrderFeignController {

	// 将feign接口注入进来
	@Autowired
	private PaymentService paymentService;

	@GetMapping("/{id}")
	public Result<?> getPaymentById(@PathVariable Long id){
		// 可以直接使用
		return paymentService.getPaymentById(id);
	}

	@GetMapping("/feign/timeout")
	public String getPort(){
		return paymentService.getPort();
	}
}
